#ifndef __MATH_HPP__
#define __MATH_HPP__

#include <math.h>
static inline int __mins_32(int x, int y) {
   return x < y ? x : y;
}
static inline int __maxs_32(int x, int y) {
   return x > y ? x : y;
}
static inline long __mins_64(long x, long y) {
   return x < y ? x : y;
}
static inline long __maxs_64(long x, long y) {
   return x > y ? x : y;
}
#ifdef RSTREAM_FLOATING_POINT_CEIL_FLOOR
static inline int __ceils_32(int x, int y) {
  return (int)ceil((double) x / (double)y);
}
static inline int __floors_32(int x, int y) {
   return (int)ceil((double) x / (double)y);
}
#else
static inline int __ceils_32(int x, int y) {
  int q = x / y;
  return (((x > 0 && y > 0) || (x < 0 && y < 0)) && 
          (x % y) != 0) ? q+1 : q;
}
static inline int __floors_32(int x, int y) {
  int q = x / y;
  return (((x > 0 && y < 0) || (x < 0 && y > 0)) && 
          (x % y) != 0) ? q-1 : q;
}
#endif // RSTREAM_FLOATING_POINT_CEIL_FLOOR

#endif // __MATH_HPP__
